package com.wnxy.portal.rabbit.config;

import org.springframework.amqp.core.Queue;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration // 配置类
public class RabbitConfig {

    /**
     * 消息系列化配置
     */
    @Bean
    public MessageConverter messageConverter(){
        return new Jackson2JsonMessageConverter();
    }

    /**
     * 创建队列, 名称是：q-email; 可以在15672控制台查看创建结果
     */
    @Bean
    public Queue createEmailQueue() {
        return new Queue("q-mail");
    }
}
